import request from "@/utils/request";

export function testHello() {
  return request({
    url: "/hello",
    method: "get",
  });
}

/**
 * 注册接口
 * 请求数据示例:
 * { "username":"xiaoming", "password":"123456", "phone":"18782855743" }
 */
export function registerApi(data) {
  return request({
    url: "/register",
    method: "post",
    data,
  });
}

/**
 * 登录接口
 * 请求数据示例:
 * { "username":"xiaoming", "password":"123456" }
 */
export function loginApi(data) {
  return request({
    url: "/login",
    method: "post",
    data,
  });
}
// 获取导航列表
export function getHeaderList() {
  return request({
    url: "/header/list",
    method: "get",
  });
}
// 增加导航
export function addHeader(data) {
  return request({
    url: "/header",
    method: "post",
    data,
  });
}
//删除导航
export function deleteHeader(_id) {
  return request({
    url: `/header/${_id}`,
    method: "delete",
  });
}
// 增加分类
export function addType(data) {
  return request({
    url: "/type",
    method: "post",
    data,
  });
}
//根据type_id查询一条分类
export function findType(_id) {
  return request({
    url: `/type/${_id}`,
    method: "get",
  });
}
//根据type_id查询一条分类
export function updateType(_id, data) {
  return request({
    url: `/type/${_id}`,
    method: "put",
    data,
  });
}
//删除type
export function deleteType(_id) {
  return request({
    url: `/type/${_id}`,
    method: "delete",
  });
}
